<template lang="pug">
  Modal.lzw-modal-style-2(v-model="bulletinModal" fullscreen title="升级公告")
    Spin(size="large" fix v-if="spinShow")
    .clearfix.text-center.mb-20
      span.pl-10.pr-10 版本号：{{bulletinData && bulletinData.versionNumber ? bulletinData.versionNumber : ''}}
      span.pl-10.pr-10 发布日期：{{bulletinData && bulletinData.releaseTime ? bulletinData.releaseTime : ''}}
    .clearfix
      .bulletin-content(v-html="bulletinContent")
    .clearfix(slot="footer")
      Button(@click="cancel") 不再弹出
</template>

<script>
import BulletinApi from '@/api/Bulletin.api.js'
export default {
  props: {
    bulletinId: String,
    spinShow: Boolean,
    bulletinData: Object
  },
  data () {
    return {
      bulletinModal: false
    }
  },
  computed: {
    bulletinContent () {
      return this.bulletinData && this.bulletinData.bulletinContent ? this.bulletinData.bulletinContent : ''
    }
  },
  methods: {
    async cancel () {
      this.bulletinModal = false
      var params = {
        BulletinId: this.bulletinId,
        Creater: JSON.parse(localStorage.getItem('clientLoginInfo')).data.userId,
        RowVersion: this.bulletinData.rowVersion
      }
      let res = await BulletinApi.SaveBulletinDetail(params)
      if (res.status === 200 && res.data.success) {
      } else {
      }
    },

    show () {
      this.bulletinModal = true
    }
  }
}
</script>

<style lang="less">
  .ss-add-modal-lzw{
    .ivu-modal-wrap{
      top:10%;
      bottom: 10%;
      left: 10%;
      right: 10%;
    }
  }
  .bulletin-content{
    img{
      width: auto;
    }
  }
</style>
